home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / program / ixemlsrc.lha / ixemul / static / private.h < prev    next >
C/C++ Source or Header  |  1995-12-23  |  4KB  |  187 lines

  1. #ifndef PRIVATE_H
  2.  
  3. #define PRIVATE_H
  4.  
  5. /*
  6. ** This header is for use ONLY with the time conversion code.
  7. ** There is no guarantee that it will remain unchanged,
  8. ** or that it will remain at all.
  9. ** Do NOT copy it to any system include directory.
  10. ** Thank you!
  11. */
  12.  
  13. /*
  14. ** Defaults for preprocessor symbols.
  15. ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
  16. */
  17.  
  18. #ifndef HAVE_ADJTIME
  19. #define HAVE_ADJTIME        1
  20. #endif /* !defined HAVE_ADJTIME */
  21.  
  22. #ifndef HAVE_SETTIMEOFDAY
  23. #define HAVE_SETTIMEOFDAY    3
  24. #endif /* !defined HAVE_SETTIMEOFDAY */
  25.  
  26. #ifndef HAVE_UNISTD_H
  27. #define HAVE_UNISTD_H        1
  28. #endif /* !defined HAVE_UNISTD_H */
  29.  
  30. #ifndef LOCALE_HOME
  31. #define LOCALE_HOME        "/usr/lib/locale"
  32. #endif /* !defined LOCALE_HOME */
  33.  
  34. /*
  35. ** Nested includes
  36. */
  37.  
  38. #include "sys/types.h"    /* for time_t */
  39. #include "stdio.h"
  40. #include "errno.h"
  41. #include "string.h"
  42. #include "limits.h"    /* for CHAR_BIT */
  43. #include "time.h"
  44. #include "stdlib.h"
  45.  
  46. #if HAVE_UNISTD_H - 0
  47. #include "unistd.h"    /* for F_OK and R_OK */
  48. #endif /* HAVE_UNISTD_H - 0 */
  49.  
  50. #if !(HAVE_UNISTD_H - 0)
  51. #ifndef F_OK
  52. #define F_OK    0
  53. #endif /* !defined F_OK */
  54. #ifndef R_OK
  55. #define R_OK    4
  56. #endif /* !defined R_OK */
  57. #endif /* !(HAVE_UNISTD_H - 0) */
  58.  
  59. /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX.  */
  60. #define is_digit(c) ((unsigned)(c) - '0' <= 9)
  61.  
  62. /*
  63. ** Workarounds for compilers/systems.
  64. */
  65.  
  66. /*
  67. ** SunOS 4.1.1 cc lacks const.
  68. */
  69.  
  70. #ifndef const
  71. #ifndef __STDC__
  72. #define const
  73. #endif /* !defined __STDC__ */
  74. #endif /* !defined const */
  75.  
  76. /*
  77. ** SunOS 4.1.1 cc lacks prototypes.
  78. */
  79.  
  80. #ifndef P
  81. #ifdef __STDC__
  82. #define P(x)    x
  83. #endif /* defined __STDC__ */
  84. #ifndef __STDC__
  85. #define P(x)    ()
  86. #endif /* !defined __STDC__ */
  87. #endif /* !defined P */
  88.  
  89. /*
  90. ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
  91. */
  92.  
  93. #ifndef EXIT_SUCCESS
  94. #define EXIT_SUCCESS    0
  95. #endif /* !defined EXIT_SUCCESS */
  96.  
  97. /*
  98. ** SunOS 4.1.1 headers lack EXIT_FAILURE.
  99. */
  100.  
  101. #ifndef EXIT_FAILURE
  102. #define EXIT_FAILURE    1
  103. #endif /* !defined EXIT_FAILURE */
  104.  
  105. /*
  106. ** SunOS 4.1.1 headers lack FILENAME_MAX.
  107. */
  108.  
  109. #ifndef FILENAME_MAX
  110.  
  111. #ifndef MAXPATHLEN
  112. #ifdef unix
  113. #include "sys/param.h"
  114. #endif /* defined unix */
  115. #endif /* !defined MAXPATHLEN */
  116.  
  117. #ifdef MAXPATHLEN
  118. #define FILENAME_MAX    MAXPATHLEN
  119. #endif /* defined MAXPATHLEN */
  120. #ifndef MAXPATHLEN
  121. #define FILENAME_MAX    1024        /* Pure guesswork */
  122. #endif /* !defined MAXPATHLEN */
  123.  
  124. #endif /* !defined FILENAME_MAX */
  125.  
  126. /*
  127. ** SunOS 4.1.1 libraries lack remove.
  128. */
  129.  
  130. #ifndef remove
  131. extern int    unlink P((const char * filename));
  132. #define remove    unlink
  133. #endif /* !defined remove */
  134.  
  135. /*
  136. ** Finally, some convenience items.
  137. */
  138.  
  139. #ifndef TRUE
  140. #define TRUE    1
  141. #endif /* !defined TRUE */
  142.  
  143. #ifndef FALSE
  144. #define FALSE    0
  145. #endif /* !defined FALSE */
  146.  
  147. #ifndef INT_STRLEN_MAXIMUM
  148. /*
  149. ** 302 / 1000 is log10(2.0) rounded up.
  150. ** Subtract one for the sign bit;
  151. ** add one for integer division truncation;
  152. ** add one more for a minus sign.
  153. */
  154. #define INT_STRLEN_MAXIMUM(type) \
  155.     ((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2)
  156. #endif /* !defined INT_STRLEN_MAXIMUM */
  157.  
  158. /*
  159. ** INITIALIZE(x)
  160. */
  161.  
  162. #ifndef GNUC_or_lint
  163. #ifdef lint
  164. #define GNUC_or_lint
  165. #endif /* defined lint */
  166. #ifndef lint
  167. #ifdef __GNUC__
  168. #define GNUC_or_lint
  169. #endif /* defined __GNUC__ */
  170. #endif /* !defined lint */
  171. #endif /* !defined GNUC_or_lint */
  172.  
  173. #ifndef INITIALIZE
  174. #ifdef GNUC_or_lint
  175. #define INITIALIZE(x)    ((x) = 0)
  176. #endif /* defined GNUC_or_lint */
  177. #ifndef GNUC_or_lint
  178. #define INITIALIZE(x)
  179. #endif /* !defined GNUC_or_lint */
  180. #endif /* !defined INITIALIZE */
  181.  
  182. /*
  183. ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
  184. */
  185.  
  186. #endif /* !defined PRIVATE_H */
  187.